import { Component, OnInit } from '@angular/core';
import { MyFollowersService } from '../services/followers.service';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/combineLatest';

@Component({
  selector: 'my-followers',
  templateUrl: './my-followers.component.html',
  styleUrls: ['./my-followers.component.css']
})
export class MyFollowersComponent implements OnInit {
  followers: object[];
  constructor(
    private route: ActivatedRoute,
    private service: MyFollowersService ) { }

  ngOnInit() {

    //获取请求中的参数
    Observable.combineLatest([
      this.route.paramMap,
      this.route.queryParamMap
    ])
    .subscribe(combined => {
      let id = combined[0].get('id');
      let page = combined[1].get('page');
    });

    this.service.getAll()
    .subscribe( followers => {
      this.followers = followers;
    })
  }

}
